import App from "../App";
import {
    Home,
    VehicleAnalysis,
    FleetUsageStats,
    VehicleCostStats,
    VehicleStatusOverview,
    DriverStatusOverview,
    VehicleUsageStats,
    FuelCardUsageStats,
    RefuelRecharge,
    RefuelRechargeRecord,
    VehicleRefuelRecord,
    VehicleRefuelRegistration,
    CarRequest,
    RequestRecords,
    DriverInfo,
    VehicleInfo,
    FuelCardInfo,
    FleetInfo,
    VehiclePartsInfo,
    VehicleRepairApply,
    VehicleRepairRecord,
    NotFound,
    ReturnRequest,
    VehicleInsuranceApply,
    VehicleInsuranceRecord,
    VehicleViolationApply,
    VehicleViolationRecord
    
} from "../page/index";
import Test from "../components/Test";
import Login from "../page/Login";
import { createHashRouter,Navigate } from "react-router-dom";



const RootRouter = createHashRouter([
    {
        path:"/",
        element:<App/>,
        children:
        [
            {
                path:"/",
                // replace属性表示这是一个替换操作，而不是在历史记录中添加新的条目。
                element: <Navigate to="/home" replace />
            },
            {
                path:"home",
                element:<Home/>,
                
            },
            {
                path:"vehicle-analysis",
                element:<VehicleAnalysis/>
               
                
            },
            {
                path:"statistics",
                children:
                [
                    { 
                        path: 'vehicle-status', 
                        element: <VehicleStatusOverview />
                    },
                    {
                        path: 'driver-status',
                        element: <DriverStatusOverview />
                    }, 
                    {
                        path: 'vehicle-usage-stats',
                        element: <VehicleUsageStats />
                    },

                    {
                        path:"fleet-usage-stats",
                        element:<FleetUsageStats/>
                    },
                    {
                        path:"cost-stats",
                        element:<VehicleCostStats/>
                    },
                    {
                        path:"fuel-card-usage-stats",
                        element:<FuelCardUsageStats/>
                    }
                ]
                
            },
            {
                path:"basic-settings",

                children:
                [
                    {
                        path:"fleet-info",
                        element:<FleetInfo/>
                    },
                    {
                        path:"fuel-card-info",
                        element:<FuelCardInfo/>
                    },
                    {
                        path:"vehicle-info",
                        element:<VehicleInfo/>
                    },
                    {
                        path:"vehicle-parts-info",
                        element:<VehiclePartsInfo/>
                    },
                    {
                        path:"driver-info",
                        element:<DriverInfo/>   
                    }
                ]
                
            },
            {
                path:"/car-management",
                
                children:
                [
                    {
                        path:"car-request",
                        element:<CarRequest/>
                    },
                    {
                        path:"request-records",
                        element:<RequestRecords/>
                    }
                ]
            },
            {
                path:"/refuel-management",
              
                children:
                [
                    {
                        
                        path:"refuel-recharge",
                        element:<RefuelRecharge/>
                    },
                    {
                        path:"vehicle-refuel-registration",
                        element:<VehicleRefuelRegistration/>
                    },
                    {
                        path:"refuel-recharge-record",
                        element:<RefuelRechargeRecord/>
                    },
                    {
                        path:"vehicle-refuel-record",
                        element:<VehicleRefuelRecord/>
                    }
                ]
            },
            {
                path:"/return-management",
                children:
                [
                    {
                        path:"return-request",
                        element:<ReturnRequest/>
                    },
                ]
            },
            {
                path:"/vehicle-repair",
                // element:<App/>,
                children:
                [
                    {
                        path:"vehicle-repair-apply",
                        element:<VehicleRepairApply/>
                    },
                    {
                        path:"vehicle-repair-record",
                        element:<VehicleRepairRecord/>
                    }
                  
                ]
            },
            {
                path:"/violations-management",
                children:
                [
                    {
                        path:"vehicle-violation-apply",
                        element:<VehicleViolationApply/>
                    },
                    {
                        path:"vehicle-violation-record",
                        element:<VehicleViolationRecord/>
                    }
                  
                ]
            },
            {
                path:"/insurance-management",
                // element:<App/>,
                children:
                [
                    {
                        path:"vehicle-insurance-apply",
                        element:<VehicleInsuranceApply/>
                    },
                    {
                        path:"vehicle-insurance-record",
                        element:<VehicleInsuranceRecord/>
                    }
                  
                ]
            },
            {
                path:"test",
                element:<Test/>
            },
           
            {
                path:"*",
                element:<NotFound/>,
            }
        ]
    },
    {
        path:"login",
        element:<Login/>
    },
   
   

   
])
export default RootRouter;




